/**
 * 
 */
package com.rd.sys.common.base;

import com.rd.sys.common.utils.CommonUtils;
import com.rd.sys.common.utils.GetWebConfig;

/**
 * The Class CommonConstants.
 * 
 * @author
 */
public class CommonConstants {
    /**
     * The Class SysParamConstants.
     */
    public static class SysParamConstants {
        /** 整型系统参数值的最多长度. */
        public static final int INTEGER_PARAM_MAX_LEN = 9;

        /** 系统字符集. */
        public static final String SYS_CHARSET = "UTF-8";

        /** 系统文件分隔符(分winodws和Linux,在此统一) */
        public static final String FILE_SEPARATOR = System.getProperty("file.separator");

        public static final String DEFAULT_3DES_KEY = "EyeVision_Default_DesKey";
    }

    /**
     * The Class SysOperatorConstants.
     */
    public static class SysOperatorConstants {
        public static final String SYS_MANAGER_NAME = "admin";
    }

    /**
     * The Class UserConstats.
     */
    public static class UserConstats {
        /** 用户唯一编码前缀 */
        public static final String USER_CODE_PRIFIX = "EV";

        /** 用户唯一编码序号长度 */
        public static final int USER_CODE_NUMBER_LENGTH = 4;

        /** 用户默认登录密码 */
        public static final String USER_LOGIN_PASSWORD = "123456";

        /** 用户默认登录密码 */
        public static final int USER_INITIAL_PASSWORD_LENGTH = 10;

        /** 用户默认登录名称 */
        public static final String USER_LOGIN_NAME = null;

        /** 用户安全密钥长度 */
        public static final int USER_SECURITY_BASEKEY_LENGTH = 24;

        /** 用户登录密码校验表达式 */
        public static final String USER_PASSWORD_RULE = "^(?![a-z]+$)(?![^A-Z0-9\\p{Punct}]+$)(?![A-Z]+$)(?![^a-z0-9\\p{Punct}]+$)"
                + "(?![0-9]+$)(?![^A-Za-z\\p{Punct}]+$)(?![\\p{Punct}]+$)(?![^A-Za-z0-9]+$)(?![^a-z0-9]+$)"
                + "(?![^A-Z0-9]+$)(?![^0-9\\p{Punct}]+$)(?![^a-zA-Z]+$)(?![^a-z\\p{Punct}]+$)"
                + "(?![^A-Z\\p{Punct}]+$).{6,20}$";

        /** 用户登录Session标识 */
        public static final String USER_SESSION_FLAG = "userinfo";

        /** 鉴权登录Session标识 */
        public static final String AUTH_LOGIN_SESSION_FLAG = "auth_login_code";

        /** 鉴权登录串的分隔符号 */
        public static final String AUTH_SPLIT_SIGN = "##";

        /** 鉴权登录随机码长度 */
        public static final int AUTH_RAND_LENGTH = 20;

        /** 鉴权登录随机码保存最大个数 */
        public static final int AUTH_RAND_SAVE_NUMBBER = 10000;

        /** 鉴权登录随机码保存最长时间(秒) */
        public static final int AUTH_RAND_SAVE_TIME = 120;

        /** 客户端访问来源标识 */
        public static final String USER_THE_CLIENT_SOURCE = "client";

        /** 激活码每位长度 */
        public static final int CLIENT_ACTIVATE_PER_NUMBER = 5;

        /** 激活码总体长度 */
        public static final int CLIENT_ACTIVATE_TOTAL_LENGTH = 20;

        /** 激活码分隔符 */
        public static final String CLIENT_ACTIVATE_SPLIT_SIGN = "-";

        /** 客户端激活MAC地址分隔符 */
        public static final String CLIENT_ACTIVATE_MAC_SPLIT_SIGN = "|";
    }

    /**
     * 数据分析公共常量
     */
    public static class AnalysisConstats {
        /** 项目描述文件名 */
        public static final String PROJECT_DESCRIPTION_FILENAME = "project.json";

        /** 方案描述文件名 */
        public static final String SCHEME_DESCRIPTION_FILENAME = "scheme.json";

        /** 被试描述文件名 */
        public static final String RESULT_DESCRIPTION_FILENAME = "result.json";

        /** 事件处理文件名称 */
        public static final String EVENT_DESCRIPTION_FILENAME = "EventInfo.json";

        /** 被试数据文件名(内部处理后) */
        public static final String DATA_PROCESSED_FILENAME = "data_processed.json";

        /** 被试数据文件名(原始) */
        public static final String DATA_RAW_FILENAME = "data_raw.json";

        /** AOI数据描述文件名 */
        public static final String AOI_DESCRIPTION_FILENAME = "aoidata.json";

        /** 被试注视点统计数据文件名(内部处理后) */
        public static final String DATA_STATISTIC_FIXATION_FILENAME = "data_statistic_fixation.json";

        /** 被试扫视点统计数据文件名(内部处理后) */
        public static final String DATA_STATISTIC_SACCADE_FILENAME = "data_statistic_saccade.json";

        /** 缓存键值分隔符 */
        public static final String CACHE_SPLIT = "##";

        /** 同步文件时锁定后缀 */
        public static final String SYNC_FILE_LOCK_SUFFIX = ".locker";

        /** 素材图片在WEB浏览器中的缓存时间 (默认90天) */
        public static final int MATERIAL_IMAGE_CACHE_TIME = GetWebConfig.getInt("material.image.cache.time", 129600) * 60;

        /** 统计分析数据精度 */
        public static final String STATISTIC_DECIMAL_PRECISION = "#.00";

        /** 统计分析计算同一注视点偏离范围(单位: px) */
        public static final double STATISTIC_FIXATION_DEVIATION = 20;

        /** 统计点最小时长(单位: 毫秒) */
        public static final long STATISTIC_FIXATION_DURATION_MIN = 100;

        /** 统计点最小个数(单位: 个) */
        public static final long STATISTIC_FIXATION_NUMBER_MIN = 6;

        /** 统计页面默认每页条数(单位: 毫秒) */
        public static final int STATISTIC_PER_PAGE_SIZE = 100;

    }

    /**
     * 导出常量.
     */
    public static class ExportConstants {
        /** 导出文件后缀格式. */
        public static String EXPORT_FILE_EXTNAME = ".csv";

        /** 导出临时文件路径. */
        public static final String EXPORT_FILE_PATH = CommonUtils.judgeConfigPath(GetWebConfig
                .getValue("export.file.temp.path"));

        /** 导出文件编码. */
        public static final String EXPORT_FILE_ENCODING = "GBK";

        /** 导出文件换行符. */
        public static final String EXPORT_NEW_LINE_SIGN = "\r\n";

        /** 导出文件内容分隔符. */
        public static final String EXPORT_FILE_SPLIT_SIGN = ",";

        /** 导出每次处理最大条数. */
        public static final int EXPORT_OPERATION_PER_MAX_NUM = 500;

        /** 导出线程池并发执行个数. */
        public static final int THREAD_POOL_CORE_SIZE = 10;

        /** 导出线程池最大执行个数. */
        public static final int THREAD_POOL_CORE_MAX_SIZE = 10;

        /** 导出线程池缓存队列个数. */
        public static final int THREAD_POOL_QUEUE_CAPACITY = 5;

        /** 导出线程池线程等待执行时间（秒）. */
        public static final int THREAD_POOL_KEEP_LIVE_TIME = 20;

        /** 导出线程池线程阻塞时间（秒）. */
        public static final int THREAD_POOL_BLOCKING_TIME = 120;

        // ***************导出配置文件标签常量 ***********/
        /** 导出配置文件名称. */
        public static final String EXPORT_CONFIG_FILE_NAME = "export_#.xml";

        /** 导出配置文件表头分割符号. */
        public static final String EXPORT_CONFIG_FILE_HEAD_SPLIT_SIGN = "##";

        /** 导出配置文件task节点. */
        public static final String EXPORT_CONFIG_FILE_NODE_TASK = "task";

        /** 导出配置文件type节点. */
        public static final String EXPORT_CONFIG_FILE_NODE_TYPE = "type";

        /** 导出配置文件head节点. */
        public static final String EXPORT_CONFIG_FILE_NODE_HEAD = "head";

        /** 导出配置文件operator节点. */
        public static final String EXPORT_CONFIG_FILE_NODE_OPERATOR = "operator";
    }

}
